package com.kcht.itsed.mws.devicescheduler.biz;

import com.shhic.itsed.mws.deviceintf.IReaderResultCallback;
import com.shhic.itsed.mws.deviceintf.RawTagOperationResult;
import com.shhic.itsed.mws.deviceintf.ReaderLinkStatusEnum;
import com.kcht.itsed.mws.devicescheduler.facade.IRawTagOperationResultSender;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;


@Component("MWSReaderOperateRsultCallback")
@Slf4j
public class MWSReaderOperateResultCallback implements IReaderResultCallback {

	
	@Autowired
	private IRawTagOperationResultSender resultSender;
	
	@Override
	public void onResult(RawTagOperationResult result) {
		log.info("驱动上报的标签--->"+"EPC码:"+result.getTagIdentifier()
				+",IP:"+result.getReaderIp()
				+",天线:"+result.getAntennaNo()
				+",时间:"+new Date(result.getDiscoverTimestamp()));
		resultSender.send(result);
	}

	@Override
	public void onError(ReaderLinkStatusEnum linkStatus, String errMsg) {
		log.info(errMsg);
	}

	@Override
	public void onIdle() {
		
	}

}
